<?php session_start();?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Won-松的留言板</title>
	<link rel="stylesheet" type="text/css" href="bass.css"/>
	<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
	<div class="wrap">
		<!--head-->
		<div class="w100">
			<!--head-top-->
			<div class="headtop w960 clearfix">
				<div class="logo fl"><a href="#"><img src="../img/logo.png"></a></div>
		<?php
			include("function.php");
			$conn = conn();
			$resourse = mysqli_query($conn,"select * from nav");   
			while ($row = mysqli_fetch_assoc($resourse)){
		?>
				<div class="nav fl">
					<ul>
						<li class="fl ml25"><a href="<?php echo $row["addr"]?>"><?php echo $row['option']?></a></li>
				</div>
		<?php
			}
		?>
			</div>
			<div class="clear"></div>
			<!--head-background-->
			<div class="bg">
				<div class="title"><h2>说点什么吧</h2></div>
			</div>
		</div>
		<div class="clear"></div>
		<!--main-->
		<?php
		include('conn.php');
		$resourse = mysql_query("select * from data order by id desc",$conn);  
		while ($row = mysql_fetch_assoc($resourse)){
		?>
			<div class="item">
				<div class="name">
					留言人：<b><?php echo $row["name"]?></b>
					<a class="a" href="edit.php?id=<?php echo $row["id"]?>">编辑</a>
					<a class="a" href="del.php?id=<?php echo $row["id"]?>">删除&nbsp;</a>
				</div>
				<div class="item_content"><?php echo $row["write"]?></div>
				<div class="time">留言时间：<?php echo date("Y-m-d H:i:s",$row["time"])?></div>
			</div>
	<?php
		}
	?>	
		<div style="width:960px; margin:10px auto; text-align:center;">
		<form action="login/login.php" method="POST">
			账户：<input type="text" name="username" placeholder="请输入账户" style="height:25px;" /><br><br>
			密码：<input type="password" name="password" placeholder="请输入密码" style="height:25px;"/><br><br>
			<input type="submit" value="登录" style="width:50px; height:25px; " />
		</form>
		</div>
		<?php
			$s = $_SESSION["is_login"];
			if ($s=='ok') {
		?>
				<form method="post" action="add.php">
				<table>
					<tr>
						<td class="content"></td>
						<td><textarea style=" width:850px; " rows="10" name="write"></textarea></td>
					</tr>
					<tr>
						<td></td>
						<td>
							<input type="submit" value="留言" style="width:100px; height:25px; " />
						</td>
					</tr>
				</table>
			</form>
			
		<?php
			}else{
		?>
				<div class="login" style="color:green; margin-top:10px; font-size:24px;">
				<?="登录留言"?>
				</div>
		<?php
			}
		?>
			
	
		</div>
	</div>
	<div class="bottom"><a href="#">置顶</a></div>
</body>
</html>

